//------- XNA-to-HLSL variables --------
float4x4 xWorldViewProjection;
//bool xEnableLighting;
//float xOvercast;
//float xTime;
bool xSetAlpha;
float xAlpha;

float calcRS;
//------- Texture Samplers --------

Texture xTexture;

sampler TextureSampler = sampler_state { texture = <xTexture>; magfilter = LINEAR; minfilter = LINEAR; mipfilter=LINEAR; AddressU = mirror; AddressV = mirror;};

 //------- Technique: StarSphere --------
 struct SSVertexToPixel
 {    
     float4 Position         : POSITION;
     float2 TextureCoords    : TEXCOORD0;
     float4 ObjectPosition    : TEXCOORD1;
 };
 
 struct SSPixelToFrame
 {
     float4 Color : COLOR0;
 };
 
 SSVertexToPixel StarSphereVS( float4 inPos : POSITION, float2 inTexCoords: TEXCOORD0)
 {    
     SSVertexToPixel Output = (SSVertexToPixel)0;
     
     Output.Position = mul(inPos, xWorldViewProjection);
     Output.TextureCoords = inTexCoords;
     Output.ObjectPosition = inPos;
     
     return Output;    
 }
 
 SSPixelToFrame StarSpherePS(SSVertexToPixel PSIn)
 {
     SSPixelToFrame Output = (SSPixelToFrame)0;        
 
     //float4 topColor = float4(0.3f, 0.3f, 0.8f, 1);    
     //float4 bottomColor = 1;    
     
     //float4 baseColor = lerp(bottomColor, topColor, saturate((PSIn.ObjectPosition.y)/0.4f));
     //float4 cloudValue = tex2D(TextureSampler, PSIn.TextureCoords).r;
     
     //Output.Color = lerp(baseColor,1, cloudValue);        

	 Output.Color = tex2D(TextureSampler, PSIn.TextureCoords);
 
	if(xSetAlpha)
		Output.Color.a = xAlpha;

     return Output;
 }
 
 technique StarSphere
 {
     pass Pass0
     {
         VertexShader = compile vs_1_1 StarSphereVS();
         PixelShader = compile ps_2_0 StarSpherePS();
     }
 }
